#
# THU-Render
#
# Copyright 2007 CG & CAD Institute, Tsinghua University.
# All rights reserved.
#

# Some commands under different platforms.
#IF(WIN32)
#    MACRO(TEST_WRAPPER _wrappee_base)
#        IF(${ARGC} GREATER 1)
#            ADD_TEST(${_wrappee_base}
#                ${EXECUTABLE_OUTPUT_PATH}/${_wrappee_base})
#        ENDIF(${ARGC} GREATER 1)
#    ENDMACRO(TEST_WRAPPER)
#ELSE(WIN32)
#    MACRO(TEST_WRAPPER _wrappee_base)
#        IF(${ARGC} GREATER 1)
#            ADD_TEST(${_wrappee_base} ${_wrappee_base})
#        ENDIF(${ARGC} GREATER 1)
#    ENDMACRO(TEST_WRAPPER)
#ENDIF(WIN32)

# This is a new version of TEST_WRAPPER with support for both cmake 2.4 and 2.6
MACRO(TEST_WRAPPER testname)
    IF(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
        # Generate test binary in this directory if specified
        ADD_TEST(${testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testname})
    ELSEIF(EXECUTABLE_OUTPUT_PATH)
        # If they are still using EXECUTABLE_OUTPUT_PATH
        ADD_TEST(${testname} ${EXECUTABLE_OUTPUT_PATH}/${testname})
    ELSE(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
        # Otherwise default to running the test runner from the default
        # location
        ADD_TEST(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname})
    ENDIF(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
ENDMACRO(TEST_WRAPPER)
